package util;

import java.util.regex.Matcher;

public class StringParser 
{

	public static String getSegmentationAlgorithm(String s) {
		
		java.util.regex.Pattern algorithm = java.util.regex.Pattern.compile("[_]{1}[a-z[A-Z]]*");
		Matcher matcher = algorithm.matcher(s);
		while (matcher.find()) {
			if(matcher.group().substring(1).equals("wahet")) {
				return "wahet";
			}
			if(matcher.group().substring(1).equals("caht")) {
				return "caht";
			}
		}
		return "";
	}
	
	public static String getFeatureExtractionAlgorithm(String s) {
		
		java.util.regex.Pattern algorithm = java.util.regex.Pattern.compile("[_]{1}[a-z[A-Z]]*");
		Matcher matcher = algorithm.matcher(s);
		while (matcher.find()) {
			if(matcher.group().substring(1).equals("qsw")) {
				return "Algorithm of Ma et al.";
			}
			if(matcher.group().substring(1).equals("lg")) {
				return "1D-LogGabor Feature Extraction";
			}
			if(matcher.group().substring(1).equals("ko")) {
				return "Algorithm of Ko et al.";
			}
			if(matcher.group().substring(1).equals("cr")) {
				return "Algorithm of Rathgeb and Uhl";
			}
			if(matcher.group().substring(1).equals("cb")) {
				return "Context-based Iris Recognition";
			}
			if(matcher.group().substring(1).equals("dct")) {
				return "Algorithm of Monro et al.";
			}
		}
		return "";
	}
	
	public static String getOriginalFileName(String s) {
		
		java.util.regex.Pattern algorithm = java.util.regex.Pattern.compile("[^_][a-z[A-Z][0-9]]+[_]{1}");
		Matcher matcher = algorithm.matcher(s);
		while (matcher.find()) {
			return matcher.group().substring(0, matcher.group().length()-1);
		}
		return "";
	}
	
}
